package com.dog.basics.api.controller.common;


import com.dog.basics.bean.vo.admin.common.BannerVo;
import com.dog.basics.common.constant.SwaggerConstants;
import com.dog.basics.common.util.R;
import com.dog.basics.security.annotation.Inner;
import com.dog.basics.service.common.ISysBannerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

/**
 * <p>
 * 轮播图 前端控制器
 * </p>
 *
 * @author fengjukang
 * @since 2019-12-13
 */
@RestController
@AllArgsConstructor
@Api(value = "轮播图", tags = SwaggerConstants.API_ALL)
@RequestMapping("/api/banner")
public class SysBannerController {

    private final ISysBannerService sysBannerService;

    /**
     * 根据所属广告-根据CODE位置 APP
     *
     * @return guonh 2019年11月11日
     */
    @ApiOperation(value = "所属广告-根据CODE位置", notes = "所属广告-根据CODE位置", tags = SwaggerConstants.API_HOME)
    @ApiImplicitParam(name = "code", value = "广告所属code", required = true, dataType = "String", paramType = "String")
    @GetMapping("/getInfoByCode/{code}")
    @Inner
    public R<List<BannerVo>> getInfoByCode(@PathVariable("code") String code) {
        return R.ok(sysBannerService.getApiBannerVoInfo(code));
    }


}
